const Qiniu = require('qiniu');
var accessKey = 'di0QoZTUFcBPUenjPF2jco9ewZR6nEHkR8kom_xv';
var secretKey = 'kF8kA-sK8I0aj4qI01x4mCY7bD1qNvG20ATLxrqI';
var mac = new Qiniu.auth.digest.Mac(accessKey, secretKey);
var options = {
  scope: 'test-jianmu',
  expires: 77777777,
  // callbackUrl: 'http://upload-z1.qiniup.com',
  callbackBody:
    '{"key":"$(key)","hash":"$(etag)","fsize":$(fsize),"bucket":"$(bucket)","name":"$(x:name)","extract":"$(x:test)"}',
  callbackBodyType: 'application/json',
};

var putPolicy = new Qiniu.rs.PutPolicy(options);
var uploadToken = putPolicy.uploadToken(mac);
console.log(uploadToken);
